<?php
/***************************************************************
*  Copyright notice
*  (c) 2008, jianyuzhu@gmail.com
*  All rights reserved
*  This script is part of the PPEMI project.
***************************************************************/

//
require(dirname(dirname(__FILE__)) . '/includes/application_top.php');

//
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'core.directory.class.php');

//
$dir = 'includes/classes/';

//
$path = CONFIG_PATH;
$cpath = 'D:/amps/www/projects/myshop/';

//
$dObj = new CoreDirectoryParser($path . $dir);
$dObj->parse();
$_dir = $dObj->_dir;
$files = $dObj->getFiles();
$dirs = $dObj->getDirs();

//
$i = 0;
if( is_array($files) ) {
	foreach($files as $key => $file) {
		if( !file_exists($cpath . $dir . $file['file']) ) {
			echo $file['file'];echo '<br>';
		} else {
			$fs = filesize($path . $dir . $file['file']);
			$cfs = filesize($cpath . $dir . $file['file']);
			if( $fs != $cfs ) {
				echo $file['file'];echo '<br>';
				//
				$cfls = file($path . $dir . $file['file']);
				$cbls = file($cpath . $dir . $file['file']);
				if( count($cfls) != count($cbls) ) {
					echo 'lines';echo '<br>';
					for($j=0, $m=count($cfls); $j<$m; $j++) {
						if( $cfls[$j] != $cbls[$j] ) {
							echo 'line-' . ($j+1);echo '<br>';
							break;
						}
					}
				} else {
					for($j=0, $m=count($cfls); $j<$m; $j++) {
						if( $cfls[$j] != $cbls[$j] ) {
							echo 'line-' . ($j+1);echo '<br>';
						}
					}
				}
				//
				$i++;
			}
		}
	}
}
//
echo $i;
//
echo 'OK';
//
?>